#include <stdio.h>
#include <stdlib.h>
#include <stdbool.h>

typedef struct Node {
    int data;
    Node *link;
}Node;

bool isEmpty(const Node *top) {
    if(top == NULL) return true;
    else return false;
}

void Push(Node **top, int data) {
    Node *newNode = (Node *)malloc(sizeof(Node));
    newNode->data = data;
    newNode->link = *top;
    *top = newNode;
}

Node *Pop(Node **top) {
    if(isEmpty(*top)) return NULL;
    Node *temp = *top;
    *top = (*top)->link;
    free(temp); 
    return *top;
}

int Peek(Node *top) {
    if(isEmpty(top)) {
        printf("Empty.\n");
        return -1;
    } 
    return top->data;
}

int main(void) {
    Node *top = NULL;
    printf("%d ",Peek(top));
    Push(&top,5);
    printf("%d ",Peek(top));
    Push(&top,1);
    printf("%d ",Peek(top));
    Push(&top,2);
    printf("%d ",Peek(top));
    Pop(&top);
    printf("%d ",Peek(top));
    return 0;
}